﻿using System;
using JetBrains.Annotations;

namespace MugenMvvmToolkit.Attributes
{
    /// <summary>
    ///     Attribute to link a property in a model to a view model.
    /// </summary>
    [AttributeUsage(AttributeTargets.Property, AllowMultiple = true, Inherited = true)]
    public sealed class ModelPropertyAttribute : Attribute
    {
        #region Constructors

        /// <summary>
        ///     Initializes a new instance of the <see cref="ModelPropertyAttribute" /> class.
        /// </summary>
        public ModelPropertyAttribute([NotNull]string modelProperty)
        {
            Should.NotBeNullOrWhitespace("model", modelProperty);
            Property = modelProperty;
        }

        #endregion

        #region Properties

        /// <summary>
        ///     Gets the property name that holds the model object.
        /// </summary>
        /// <value>The model property name.</value>
        public string Property { get; private set; }

        #endregion
    }
}